/*
 * @Description: 部门管理api文件
 * @FilePath: \hk-computerRoom-Security\src\api\system\dept\index.ts
 * @Date: 2023-07-31 17:26:13
 * @LastEditTime: 2024-01-18 10:00:52
 */
import axiosRequest from '/@/utils/request';

/**
 * （不建议写成 request.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 * @method getListDept 查询所有部门
 * @method addDept 新增部门
 * @method updateDept 修改部门
 * @method addDeptUserAndPost 分配部门用户和岗位
 * @method delDeptById 删除部门
 */
export function useDeptApi() {
  return {
    getListDept: async (params: object) => {
      return await axiosRequest({
        url: '/api/dept/listDept',
        method: 'POST',
        data: params,
      });
    },
    addDept: async (params: object) => {
      return await axiosRequest({
        url: '/api/dept/addDept',
        method: 'POST',
        data: params,
      });
    },
    addDeptUserAndPost: async (params: object) => {
      return await axiosRequest({
        url: '/api/dept/addDeptUserAndPost',
        method: 'POST',
        data: params,
      });
    },
    updateDept: async (params: object) => {
      return await axiosRequest({
        url: '/api/dept/updateDept',
        method: 'POST',
        data: params,
      });
    },
    delDeptById: async (id: string) => {
      return await axiosRequest({
        url: `/api/dept/deleteDept/${id}`,
        method: 'GET',
      });
    },
  }
}
